<!DOCTYPE html>
<html class="um landscape min-width-240px min-width-320px min-width-480px min-width-768px min-width-1024px">
<head>
<title></title>
<meta charset="utf-8">
<meta name="viewport" content="target-densitydpi=device-dpi, width=device-width, initial-scale=1, user-scalable=no, minimum-scale=1.0, maximum-scale=1.0">
<meta name="copyright" content="http://www.appcms.org" />
<link rel="stylesheet" href="skin/base.css">
<link rel="stylesheet" href="skin/user.css">
<script src="js/zy_control.js"></script>
<script src="js/zy_click.js"></script>
<script src="js/config.js"></script>
</head>
<body ontouchstart>
<div id="main"></div>
</body>
<script>
	zy_init();
	
	function getMain(){
		$$('main').innerHTML='';
		$$('main').className="loading";
		var url = app_path+'index.php?m=iapp&c=app&a=skin';
		uexXmlHttpMgr.open(0,'post',url,"8000");
		uexXmlHttpMgr.send(0);
	}
	
	window.uexOnload=function(type){
		if (!type){
			
			uexWindow.setBounce("1");
			uexWindow.showBounceView("0","#666","0");
			uexWindow.showBounceView("1","#666","0");
			
			uexXmlHttpMgr.onData = function(opId, status, data){
				uexXmlHttpMgr.close(opId);
				if(status==1){
					$$("main").className = '';
					data = JSON.parse(data);
					var html = '<ul class="user_skin">';
					for(k in data){
						html += '<li onclick="javascript:setSkin(\''+data[k]['skin']+'\',\''+data[k]['title']+'\');" style="'+data[k]['vskin']+'">'+data[k]['title']+'</li>';						
					}
					html += '</ul>';
					$$('main').innerHTML=html;
					
				}else if(status ==-1) {
					uexWindow.toast("0","5",'加载失败,请点击重新加载',1000);
					$$("main").className='errer';
					$$('main').setAttribute("onclick", "javascript:getMain();"); 
				}
			}
			getMain();
		}
	}
	
	function setSkin(skin,title){
		localStorage['skin'] = skin;
		localStorage['skin_title'] = title;
		
		for(k in l_footer){
			try{ 
				uexWindow.evaluateScript(k,0,'uexWindow.close(0)');
			}catch(e){ 
				
			}
		}
		
		if (pattern_type == "simple") {
			uexWindow.evaluateScript('root',0,'closePopover("menu")');
		}else if(pattern_type == "winphone"){
			uexWindow.evaluateScript('main_winphone',0,'uexWindow.close(0)');
		}
		
		uexWindow.evaluateScript('setting',0,'uexWindow.close(0)');
		
		uexWindow.toast("0","5",'风格设置成功~',1000);
		uexWindow.evaluateScript('root',0,'openmain()');
		uexWindow.evaluateScript('skin',0,'uexWindow.close(0)');
	}
	
	</script>
</html>